const webpackConfig = require('./webpack.prod')
const webpack = require('webpack')
const ora = require('ora')
const chalk = require('chalk')

const spinner = ora('building for production...')
spinner.start()
webpack(webpackConfig, (_err, stats) => {
  spinner.stop()
  if (_err) throw _err
  process.stdout.write(stats.toString({
    colors: true,
    modules: false,
    children: false,
    chunks: false,
    chunkModules: false
  }) + '\n\n')

  console.log(chalk.cyan('  Build complete.\n'))
})
